package cn.eyecool.qmuidemo;

import android.graphics.Color;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;

public class QMUITopBarLayoutActivity extends AppCompatActivity {

    private QMUITopBarLayout mTopBarLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qmuitop_bar_layout);

        mTopBarLayout = findViewById(R.id.topbar);
        mTopBarLayout.setBackgroundColor(getResources().getColor(R.color.app_color_blue));
        mTopBarLayout.setTitle("标题").setTextColor(ContextCompat.getColor(this, R.color.white));
        QMUIAlphaImageButton qmuiAlphaImageButton = mTopBarLayout.addLeftBackImageButton();
        qmuiAlphaImageButton.setColorFilter(Color.WHITE);
        qmuiAlphaImageButton.setOnClickListener(v -> finish());
    }
}